import uuid from 'uuid';
import insert from './atom/db/insert';
import { IBaseTable } from './atom/db/interfaces';

declare const action_id: string;
declare const session_id: string;
declare const spaceid: string;

interface Message {
	user_code: string; user_name: string; screen_no: number;
}

async function atom(msg: Message) {
	const systemid = '6051';
	const { exec, prepare } = insert(action_id, session_id, spaceid, systemid);

	// 桌面分屏
	prepare('desk_screen', [{ _id: uuid(), no: uuid(), user_code: msg.user_code, user_name: msg.user_name, screen_no: msg.screen_no }]);
	const res = await exec();

	if (res.code === 1) {
		return 'success';
	} else {
		return 'fail';
	}
}